package com.zxx.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.Map;

@Data
@Document(indexName = "goods")
public class Goods {

    @Id
    private int id;
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String title;
    @Field(type = FieldType.Double)
    private double price;
    @Field(type = FieldType.Integer)
    private int stock;
    @Field(type = FieldType.Integer)
    private int saleNum;
    @Field(type = FieldType.Date)
    @JSONField(format="yyyyMMdd")
    private Date createTime;
    @Field(type = FieldType.Keyword)
    private String categoryName;
    @Field(type = FieldType.Keyword)
    private String brandName;
    @Field(type = FieldType.Object)
    private Map spec;

    private String specStr;

}
